package com.goods.business.service.imp;


import com.goods.business.mapper.HealthMapper;
import com.goods.business.service.HealthService;
import com.goods.common.model.business.Health;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class HealthServiceImpl implements HealthService {
    @Autowired
    private HealthMapper healthMapper;


    @Override
    public Boolean isToday() {
        Integer isToday  = healthMapper.selectDay(new Date());
        if(isToday>0){
            return true;
        }
        return false;
    }

    @Override
    public void report(Health health) {
        health.setUserId(5L);
        health.setCreateTime(new Date());
        healthMapper.insert(health);
    }

    @Override
    public List<Health> history() {
        Health health = new Health();
        health.setUserId(5L);
        List<Health> select = healthMapper.select(health);
        return select;
    }
}
